package cn.aylog.test;

import cn.aylog.dao.MoneyDao;
import cn.aylog.pojo.Money;
import cn.aylog.service.impl.MoneyServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application.xml")
public class SpringMybatisDemo3 {

    @Autowired
    private MoneyDao dao;

    @Autowired
    private MoneyServiceImpl service;

    @Test
    public void run() {
        List<Money> list = dao.selectAll();
        System.out.println(list);
    }

    @Test
    public void run2() {
        Money from = new Money();
        Money to = new Money();
        from.setUserId(5);
        to.setUserId(6);

        boolean flag = service.transMoney(from, to, 100);
        System.out.println(flag);
    }

}
